<?php
/**
 * Created by PhpStorm.
 * User: ADMIN
 * Date: 2021/6/27
 * Time: 7:07
 */

namespace app\adminapi\validate;

class TemplateAdd extends Base
{
    protected $rule = [
        'name' => 'require|nameUnique',
        'src' => 'require',
    ];

    protected $message = [
        'name.nameUnique' => '基础模板名唯一',
    ];

    /**
     * 变更功能名唯一
     */
    protected function nameUnique($value)
    {
        if (db('template')->where("name='{$value}'")->count()) return false;
        return true;
    }

}